package com.it.controller;

import com.it.enity.result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;



@ControllerAdvice
public class BaseExceptionHandler {
//    private Logger logger= LoggerFactory.getLogger(BaseExceptionHandler.class);

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public result error(Exception e){
        e.printStackTrace();
        System.out.println("调用了异常处理");
        return new result(1,e.getMessage());
    }

}
